<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分类新增</title>
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <link rel="stylesheet" type="text/css" href="../../static/lib/editormd/css/editormd.min.css">
    <link rel="stylesheet" type="text/css" href="../../static/css/myStyle.css">
</head>
<body>
    <!--导航栏-->
    <nav id="nav" th:replace="admin/_fragments :: menu(2)" class="ui inverted attached m-padded-tb-mini">
        <div class="ui container">
            <div class="ui inverted secondary stackable menu">
                <h2 class="ui teal header item" style="font-family: STSong">后台管理</h2>
                <!--<div class="right m-item item m-mobile-hide">-->
                <a href="" class="m-item item m-mobile-hide"><i class="home icon"></i>博客</a>
                <a href="" class="m-item item m-mobile-hide"><i class="clone outline icon"></i>分类</a>
                <a href="" class="m-item item m-mobile-hide"><i class="tags icon"></i>标签</a>
                <!--</div>-->
                <div class="right m-item m-mobile-hide menu">
                    <div class="ui dropdown item">
                        <div class="text">
                            <img src="../../static/images/avatar.jpg" class="ui avatar image">
                            LENSTAR
                        </div>
                        <i class="dropdown icon"></i>
                        <div class="menu m-opacity">
                            <a href="#" class="item">注销</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <a href="#" class="ui menu toggle button m-right-top m-mobile-show"
           style="background-color: rgba(0,0,0,0); color: gainsboro">
            <i class="sidebar icon"></i>
        </a>
    </nav>
    <!--副导航栏-->
    <div class="ui attached pointing menu m-opacity">
        <div class="ui container">
            <div class="right menu">
                <a href="#" th:href="@{/admin/types/input}" class="teal active item">新增</a>
                <a href="#" th:href="@{/admin/types}" class="item">列表</a>
            </div>
        </div>
    </div>
    <!--中间内容-->
    <div class="m-padded-tb-large m-container-small">
        <div class="ui container m-opacity">
            <form action="#" th:action="*{id}==null ? @{/admin/types} : @{/admin/types/{id}(id=*{id})}" method="post" class="ui segment form">
                <input type="hidden" name="id" th:value="${type.getId()}">
                <div class="required field">
                    <div class="ui left labeled input">
                        <label class="ui teal basic label">名称</label>
                        <input type="text" name="name" placeholder="分类名称" th:value="${type.getName()}">
                    </div>
                </div>

                <!--错误信息-->
                <div class="ui error message"></div>
                <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}" th:text="|提示： ${message}">提示：不能添加重复的分类</div>
                <!--按钮组-->
                <div class="ui right aligned container">
                    <button type="button" class="ui red button" onclick="window.history.go(-1)">返回</button>
                    <button class="ui teal button">提交</button>
                </div>

            </form>
        </div>
    </div>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>

    <!--底部栏-->
    <footer th:replace="admin/_fragments :: footer" class="ui inverted vertical m-padded-tb-massive">
        <div class="ui center aligned container">
            <div class="ui inverted divided stackable grid">
                <div class="four wide column">
                    <img src="../../static/images/wechat.jpg" alt="" style="width: 100px;">
                </div>
                <div class="four wide column">
                    <h4 class="ui inverted header m-text-spaced m-text-thin">最新博客</h4>
                    <div class="ui inverted link list">
                        <a href="" class="item">Java（User Story）</a>
                        <a href="" class="item">Linux（User Story）</a>
                        <a href="" class="item">Redis（User Story）</a>
                    </div>
                </div>
                <div class="four wide column">
                    <h4 class="ui inverted header m-text-spaced m-text-thin">联系我</h4>
                    <div class="ui inverted link list">
                        <a href="" class="item">邮箱：XX181028@163.com</a>
                        <a href="" class="item">QQ：1412265423</a>
                    </div>
                </div>
                <div class="four wide column">
                    <h4 class="ui inverted header m-text-spaced m-text-thin">LENSTAR</h4>
                    <p class="m-text-spaced m-text-thin m-opacity-mini" style="color: gainsboro">
                        这是我的个人博客，会分享我所学到的任何知识，希望和大家一起共同进步.....
                    </p>
                </div>
            </div>
            <div class="ui inverted section divider"></div>
            <p class="m-text-spaced m-text-thin m-opacity-mini" style="color: gainsboro">
                Copyright © 2020-2021 LENSTAR Designed by LENSTAR
            </p>
        </div>
    </footer>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
    <script>
        // 点击按钮触发事件
        $('.menu.toggle').click(function () {
            $('.m-item').toggleClass('m-mobile-hide');
        });

        //下拉框悬浮显示
        $('.ui.dropdown').dropdown({
            on: 'hover'
        });

        // 表单验证
        $('.ui.form').form({
            fields: {
                title: {
                    identifier: 'name',
                    rules: [{
                        type: 'empty',
                        prompt: '标题：请输入分类名称'
                    }]
                }
            }
        });

    </script>
</body>
</html>